<?php

require_once("inc.member.php");



$this_title="$vars[title] &raquo; ".__("Account Information");

$page_title=__("Account Information");

$content_title=__("Account Information");



$r_status_d=array("normal"=>__("Normal"),"inactive"=>__("Inactive"),"unverified"=>__("Unverified"),"suspended"=>__("Suspended"),"terminated"=>__("Terminated"));

$r_yesno_d=array("y"=>__("Yes"), "n"=>__("No"));



$td_width=190;

if($r_user["status"]=='inactive'){
$acc="
<font size='4' color='red'><b>".__('Although successfully registered your account, but the company so far not yet received your payment.')."<br><br>".__('Please make sure you have make the payment.')." ".__('If you have any question please contact +60122975758.')."</b></font>
";
}else{
$acc='
		<div style="margin:0px auto;padding:0px;z-index:3;position:relative;float:left;color:#F9D27C;font-family:Lucida Sans;FONT-SIZE:16px;">&nbsp;<img src=\'./images/titlebar1.png\' height="40px"/></div>
        <div style="margin:0px auto;padding:10px 0px 10px 0px;z-index:3;position:relative;float:left;color:#F9D27C;font-family:Lucida Sans;FONT-SIZE:16px;background-image:url(\'images/titlebar2.png\');width:710px">'.__('Account Information').'</div>
        <div style="margin:0px auto;padding:0px;z-index:3;position:relative;float:left;color:#F9D27C;font-family:Lucida Sans;FONT-SIZE:16px;"><img src=\'./images/titlebar3.png\' height="40px"/></div>
        <div style="margin:0px auto;margin-left:10px;padding:10px;position:relative;float:left;width:710px;color:#fff;font-family:Lucida Sans;FONT-SIZE:13px;">
          <table style="">
            <tr style="font-family:Lucida Sans;FONT-SIZE:13px;color:#F9D27C;font-weight:bold;text-align:center;">
              <td style="border:1px solid #fff;width:110px;border-top:0px;text-align:left;">'.__("Member ID").__(":").'</td>
              <td style="border:1px solid #fff;width:600px;border-top:0px;text-align:left;">'.$r_user[code].'</td>
            </tr>
            <tr style="font-family:Lucida Sans;FONT-SIZE:13px;color:#F9D27C;font-weight:bold;text-align:center;">
              <td style="border:1px solid #fff;width:110px;border-top:0px;text-align:left;">'.__("Name").__(":").'</td>
              <td style="border:1px solid #fff;width:600px;border-top:0px;text-align:left;">'.$r_user[name].'</td>
            </tr>
            <tr style="font-family:Lucida Sans;FONT-SIZE:13px;color:#F9D27C;font-weight:bold;text-align:center;">
              <td style="border:1px solid #fff;width:110px;border-top:0px;text-align:left;">'.__("Status").__(":").'</td>
              <td style="border:1px solid #fff;width:600px;border-top:0px;text-align:left;">'.__($r_status_d[$r_user["status"]]).'</td>
            </tr>
            <tr style="font-family:Lucida Sans;FONT-SIZE:13px;color:#F9D27C;font-weight:bold;text-align:center;">
              <td style="border:1px solid #fff;width:110px;border-top:0px;text-align:left;">'.__("Activated").__(":").'</td>
              <td style="border:1px solid #fff;width:600px;border-top:0px;text-align:left;">'.__($r_yesno_d[$r_user["activated"]]).($r_user["activated"]!="y"? "<br />\n<span class='italic'>".replace_tag(__("To activate your account, please click <%link%>here<%/link%>."), array("<%link%>"=>"<a href='".$vars["file"]["member"]["activate"]."'>", "<%/link%>"=>"</a>"))."</span>" : "").'</td>
            </tr>
            <tr style="font-family:Lucida Sans;FONT-SIZE:13px;color:#F9D27C;font-weight:bold;text-align:center;">
              <td style="border:1px solid #fff;width:110px;border-top:0px;text-align:left;">'.__("Rank").__(":").'</td>
              <td style="border:1px solid #fff;width:600px;border-top:0px;text-align:left;">'.($r_user["rank_a"]? __($vars['rank_index_a_d'][$r_user["rank_a"]]) : __("None")).'</td>
            </tr>
            <tr style="font-family:Lucida Sans;FONT-SIZE:13px;color:#F9D27C;font-weight:bold;text-align:center;">
              <td style="border:1px solid #fff;width:110px;border-top:0px;text-align:left;">'.__("Last Login").__(":").'</td>
              <td style="border:1px solid #fff;width:600px;border-top:0px;text-align:left;">'.($r_user["last_login2"]=="0000-00-00 00:00:00"? __("Never") : date($vars["date_format"], strtotime($r_user["last_login2"]))).'</td>
            </tr>
          </table>
          <br>
        </div>';

//javascript

ob_start();

$jvscript = ob_get_clean();



$this_year = ndate('Y');

$this_month = ndate('n');

$this_month_starttime = mktime(0,0,0,ndate('n'),1,ndate('Y'));

$this_month_endtime = mktime(23,59,59,ndate('n')+1,0,ndate('Y'));

$this_month_start = date("Y-m-d H:i:s", $this_month_starttime);

$this_month_end = date("Y-m-d H:i:s", $this_month_endtime);

$last_month_time = mktime(0,0,0,$this_month-1,1,$this_year);

$last_year = date('Y', $last_month_time);

$last_month = date('n', $last_month_time);

$next_month_time = mktime(0,0,0,$this_month+1,1,$this_year);

$next_year = date('Y', $next_month_time);

$next_month = date('n', $next_month_time);

$last_month_starttime = mktime(0,0,0,$this_month-1,1,ndate('Y'));

$last_month_endtime = mktime(23,59,59,$this_month,0,ndate('Y'));

$last_month_start = date("Y-m-d H:i:s", $last_month_starttime);

$last_month_end = date("Y-m-d H:i:s", $last_month_endtime);

$this_month_maintain = @mysql_result(mysql_query("select sum(amount) from $db->member_maintain where uid='$uid' and year='$this_year' and month='$this_month'"), 0);

$last_month_maintain = @mysql_result(mysql_query("select sum(amount) from $db->member_maintain where uid='$uid' and year='$last_year' and month='$last_month'"), 0);

$next_month_maintain = @mysql_result(mysql_query("select sum(amount) from $db->member_maintain where uid='$uid' and year='$next_year' and month='$next_month'"), 0);

$this_month_maintain_sales = calc_personal_sales($uid, $this_month_start, $this_month_end);

$last_month_maintain_sales = calc_personal_sales($uid, $last_month_start, $last_month_end);

$point='
		<div style="margin:0px auto;padding:0px;z-index:3;position:relative;float:left;color:#F9D27C;font-family:Lucida Sans;FONT-SIZE:16px;">&nbsp;<img src=\'./images/titlebar1.png\' height="40px"/></div>
        <div style="margin:0px auto;padding:10px 0px 10px 0px;z-index:3;position:relative;float:left;color:#F9D27C;font-family:Lucida Sans;FONT-SIZE:16px;background-image:url(\'images/titlebar2.png\');width:710px">'.__("Your Account Points").'</div>
        <div style="margin:0px auto;padding:0px;z-index:3;position:relative;float:left;color:#F9D27C;font-family:Lucida Sans;FONT-SIZE:16px;"><img src=\'./images/titlebar3.png\' height="40px"/></div>
        <div style="margin:0px auto;margin-left:10px;padding:10px;position:relative;float:left;width:710px;color:#fff;font-family:Lucida Sans;FONT-SIZE:13px;">
          <table style="">
            <tr style="font-family:Lucida Sans;FONT-SIZE:13px;color:#F9D27C;font-weight:bold;text-align:center;">
              <td style="border:1px solid #fff;width:300px;border-top:0px;text-align:left;">'.replace_tag(__("<%title%> Account Balance"), array("<%title%>"=>__($vars["ewallet_title"]))).__(":").'</td>
              <td style="border:1px solid #fff;width:410px;border-top:0px;text-align:left;">'.number_format($r_user["ewallet"], 2).'</td>
            </tr>
            <tr style="font-family:Lucida Sans;FONT-SIZE:13px;color:#F9D27C;font-weight:bold;text-align:center;">
              <td style="border:1px solid #fff;width:300px;border-top:0px;text-align:left;">'.replace_tag(__("<%title%> Account Balance"), array("<%title%>"=>__($vars["eswallet_title"]))).__(":").'</td>
              <td style="border:1px solid #fff;width:410px;border-top:0px;text-align:left;">'.number_format($r_user["eswallet"], 2).'</td>
            </tr>
            <tr style="font-family:Lucida Sans;FONT-SIZE:13px;color:#F9D27C;font-weight:bold;text-align:center;">
              <td style="border:1px solid #fff;width:300px;border-top:0px;text-align:left;">'.replace_tag(__("<%title%> Account Balance"), array("<%title%>"=>__($vars["cwallet_title"]))).__(":").'</td>
              <td style="border:1px solid #fff;width:410px;border-top:0px;text-align:left;">'.number_format($r_user["cwallet"], 2).'</td>
            </tr>
            <tr style="font-family:Lucida Sans;FONT-SIZE:13px;color:#F9D27C;font-weight:bold;text-align:center;">
              <td style="border:1px solid #fff;width:300px;border-top:0px;text-align:left;">'.replace_tag(__("<%title%> Account Balance"), array("<%title%>"=>__($vars["swallet_title"]))).__(":").'</td>
              <td style="border:1px solid #fff;width:410px;border-top:0px;text-align:left;">'.number_format($r_user["swallet"]+$r_user["s2wallet"], 2).'</td>
            </tr>
            <tr style="font-family:Lucida Sans;FONT-SIZE:13px;color:#F9D27C;font-weight:bold;text-align:center;">
              <td style="border:1px solid #fff;width:300px;border-top:0px;text-align:left;">'.replace_tag(__("<%title%> Account Balance"), array("<%title%>"=>__($vars["mwallet_title"]))).__(":").'</td>
              <td style="border:1px solid #fff;width:410px;border-top:0px;text-align:left;">'.number_format($r_user["mwallet"], 2).'</td>
            </tr>
          </table>
        </div>';
        


$content='
<div class="row">
	<div class="col-sm-12">
		<div class="panel panel-primary">
			<div class="panel-heading">'.__("Account Information").'</div>
	 		<div class="panel-body">
				<form class="form-horizontal">
					<dl class="dl-horizontal">
                            <dt>'.__("Member ID").__(":").'</dt>
                            <dd>'.$r_user['code'].'</dd>
                            <dt>'.__("Name").__(":").'</dt>
                            <dd>'.$r_user['name'].'</dd>
                            <dt>'.__("Status").__(":").'</dt>
                            <dd>'.__($r_status_d[$r_user["status"]]).'</dd>
                            <dt>'.__("Rank").__(":").'</dt>
                            <dd>'.($r_user["rank_a"]? __($vars['rank_index_a_d'][$r_user["rank_a"]]) : __("None")).'</dd>
                            <dt>'.__("Last Login").__(":").'</dt>
                            <dd>'.($r_user["last_login2"]=="0000-00-00 00:00:00"? __("Never") : date($vars["date_format"], strtotime($r_user["last_login2"]))).'</dd>
                    </dl>
				</form>
			</div>
		</div>
	</div>
</div>
<div class="row">
	<div class="col-sm-12">
		<div class="panel panel-primary">
			<div class="panel-heading">'.__("Your Account Points").'</div>
	 		<div class="panel-body">
				<form class="form-horizontal">
					<dl class="dl-horizontal">
                            <dt>'.__("IP1").__(":").'</dt>
                            <dd>'.number_format($r_user["ewallet"], 2).'</dd>
                            <dt>'.__("IP2").__(":").'</dt>
                            <dd>'.number_format($r_user["eswallet"], 2).'</dd>
                            <dt>'.__("IP3").__(":").'</dt>
                            <dd>'.number_format($r_user["cwallet"], 2).'</dd>
                            <dt>'.__("IP4").__(":").'</dt>
                            <dd>'.number_format($r_user["mwallet"], 2).'</dd>
                            <dt>'.__("SP1").__(":").'</dt>
                            <dd>'.number_format($r_user["owallet"], 0).'</dd>
                            <dt>'.__("SP2").__(":").'</dt>
                            <dd>'.number_format($r_user["swallet"], 0).'</dd>
                    </dl>
				</form>
			</div>
		</div>
	</div>
</div>';
        
}




print format_member_page($content, $this_title, $content_title, $jvscript);

?>